Page({
  data: {
    swiperList: [],
    catitemList: [],
    floordata:[]
  },
  onLoad: function () {
    //获取轮播图数据
    this.getSwiperList();
    //获取导航数据
    this.getCatitemsList();
    this.getfloordata()
  },
  changeUrlData:function(data){
    return data.map(item=>(item.navigator_url).replace("main","category"))
 },
  getSwiperList: async function () {
    let { data } = await wx.homeApi.getSwiperData()
    data.message.map(item=>item.navigator_url = (item.navigator_url).replace("main","category"))
    // let { data } = await wx.$http({ url: "home/swiperdata" });
    this.setData({
      swiperList: data.message
    })
  },
  getCatitemsList: async function () {
    let { data } = await wx.homeApi.getCatitems()

    // let { data } = await wx.$http({ url: "home/catitems" });
    console.log(data);
    this.setData({
      catitemList: data.message
    })
  },
  getfloordata:async function(){
    let { data } = await wx.homeApi.getFloordata()
    // let {data} = await wx.$http({url:"home/floordata"});
    console.log(data);
    this.setData({
      floordata:data.message
    })
  },
 
})
